#ifndef PROTREETHREAD_H
#define PROTREETHREAD_H

#include <QThread>
#include <QTreeWidget>

class ProTreeThread : public QThread
{
        Q_OBJECT
public:
    ProTreeThread(const QString &src_path, const QString &dist_path, QTreeWidgetItem *parent_item,
                  int file_count, QTreeWidget *self, QTreeWidgetItem *root, QObject *parent = nullptr);

    ~ProTreeThread();

protected:
    virtual void run();

private:
    void CreateProTree(const QString &src_path, const QString &dist_path, QTreeWidgetItem *parent_item,
                       int &file_count, QTreeWidget *self, QTreeWidgetItem *root, QTreeWidgetItem *preItem = nullptr);

    QString _src_path;
    QString _dist_path;     // 目的路径
    int _file_count;
    QTreeWidgetItem *_parent_item;
    QTreeWidget *_self;
    QTreeWidgetItem *_root;
    bool _bstop;

public slots:
    void SlotCancelProgress();      // 进度条对话框取消时，给线程实现的槽

signals:
    void SigUpdateProgress(int);    // 进度条更新
    void SigFinishProgress(int);        // 进度条完成

};

#endif // PROTREETHREAD_H
